import 'package:flutter/foundation.dart';

class UploadPicBean {
  ///上传类型
  ///
  ///* public 公有
  ///* private 私有
  String uploadType;

  ///图片来源
  ///
  ///* portal 门户
  ///* saleIn 收房
  ///* saleOut 出房
  String picOrigin;

  ///要上传图片地址列表
  List<String> picList;

  ///是否使用native的loadingDialog
  bool useNativeLoadingDialog;

//  UploadPicBean({this.uploadType, this.picOrigin, this.picList});

  ///上传到私有-门户
  UploadPicBean.privatePortal({
    @required this.picList,
    this.useNativeLoadingDialog = true,
  }) {
    this.uploadType = "private";
    this.picOrigin = "portal";
  }

  ///上传到私有-收房
  UploadPicBean.privateSaleIn({
    @required this.picList,
    this.useNativeLoadingDialog = true,
  }) {
    this.uploadType = "private";
    this.picOrigin = "saleIn";
  }

  ///上传到私有-出房
  UploadPicBean.privateSaleOut({
    @required this.picList,
    this.useNativeLoadingDialog = true,
  }) {
    this.uploadType = "private";
    this.picOrigin = "saleOut";
  }

  ///上传到公有-门户
  UploadPicBean.publicPortal({
    @required this.picList,
    this.useNativeLoadingDialog = true,
  }) {
    this.uploadType = "public";
    this.picOrigin = "portal";
  }

  ///上传到公有-收房
  UploadPicBean.publicSaleIn({
    @required this.picList,
    this.useNativeLoadingDialog = true,
  }) {
    this.uploadType = "public";
    this.picOrigin = "saleIn";
  }

  ///上传到公有-出房
  UploadPicBean.publicSaleOut({
    @required this.picList,
    this.useNativeLoadingDialog = true,
  }) {
    this.uploadType = "public";
    this.picOrigin = "saleOut";
  }

  UploadPicBean.fromJson(Map<String, dynamic> json) {
    this.uploadType = json['uploadType'];
    this.picOrigin = json['picOrigin'];
    this.useNativeLoadingDialog = json['useNativeLoadingDialog'];

    List<dynamic> picListList = json['picList'];
    this.picList = new List();
    this.picList.addAll(picListList.map((o) => o.toString()));
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['uploadType'] = this.uploadType;
    data['picOrigin'] = this.picOrigin;
    data['picList'] = this.picList;
    data['useNativeLoadingDialog'] = this.useNativeLoadingDialog;
    return data;
  }
}
